package edu.psu.collegerecommendationhelper.algorithm;

import java.net.URL;

/**
 * 
 * @author cbarone
 *
 * This class parses the config directory path and returns the 
 * path plus file name.
 */
		
public class FileLocator {

	public static String arffName = "2011data.arff";
	public static String modelName = "2011model.model";
	
	public FileLocator() {
		
	}
	
	private String locator() {
		URL location = this.getClass().getProtectionDomain().getCodeSource().getLocation();
		String s = location.toString();
		String cdhDir = s.substring(s.lastIndexOf('/')-14);
		
		String[] locationSplit = s.split(cdhDir);
		String configDir = locationSplit[0] + "/config/";
		
		String modifyDir = configDir.substring(configDir.lastIndexOf(':')+1);		

		String result = modifyDir;
			
		return result;
	}
	
	
	public String getArffLocation() {
		return (locator() + arffName);
	}

	public String getModelLocation() {
		return (locator() + modelName);
	}
}
